﻿@model ZhongheCms.Models.GswTblBusInfo
@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/_Layout.cshtml";
    string strSelect = "";
}
@section css{

    <link rel="stylesheet" href="/kindeditor/themes/default/default.css" />
    <link rel="stylesheet" href="/Assets/webuploader/webuploader.css" />
    <link href="/Assets/css/select2.css" rel="stylesheet">
    <link href="/Assets/css/select2-bootstrap.css" rel="stylesheet">
    <link rel="stylesheet" href="/Assets/css/datepicker.css" />
}
<div class="row">
    <div class="col-xs-12 col-sm-12 widget-container-col">
        @using (Html.BeginForm("Create", "BusInfo", new { id = Model.Id, ViewBag.m, ViewBag.f, ViewBag.p, ViewBag.fid, ViewBag.sdate, ViewBag.edate, ViewBag.keywords}, FormMethod.Post,
            new { name = "myForm", id = "myForm", @class = "form-horizontal", role = "form" }))
        {
            <div class="widget-box">
                <div class="widget-header">
                    <h5 class="widget-title">@ViewBag.f  @if (!string.IsNullOrEmpty(ViewBag.p))
                                                         {
                            <span>(@ViewBag.p)</span>
                                                         }</h5>

                    <div class="widget-toolbar">
                    </div>
                </div>

                <div class="widget-body">


                    <div class="widget-main">

                        <div class="form-group">
                            <table id="sample-table-1" class="table table-bordered table-hover">
                                <tbody>
                                    <tr>
                                        <td class="align-right" style="width: 15%; background: #f6f6f6">发车日期
                                        </td>
                                        <td>

                                            <input  id="StartDate" name="StartDate" placeholder="" type="text" class="form-control" value="@Model.StartDate.ToShortDateString()"  />

                                        </td>
                                        <td class="align-right" style="width: 15%; background: #f6f6f6">发车时间
                                        </td>
                                        <td>

                                            <input  id="StartTime" name="StartTime" placeholder="" type="text" class="form-control" value="@Model.StartTime"  data-val="true"  data-val-required="发车时间不允许为空" />
                                            <span class="field-validation-valid help-block" data-valmsg-for="StartTime" data-valmsg-replace="true"></span>
                                        </td>

                                    </tr>

                                    <tr>
                                        <td class="align-right" style="width: 15%; background: #f6f6f6">发车地点
                                        </td>
                                        <td>
                                            <input  id="OriginPlace" name="OriginPlace" placeholder="" type="text" class="form-control" value="@Model.OriginPlace" data-val="true"  data-val-required="发车时间不允许为空"  />
                                            <span class="field-validation-valid help-block" data-valmsg-for="OriginPlace" data-valmsg-replace="true"></span>

                                        </td>
                                        <td class="align-right" style="width: 15%; background: #f6f6f6">目的地
                                        </td>
                                        <td>

                                            <input  id="EndPlace" name="EndPlace" placeholder="" type="text" class="form-control" value="@Model.EndPlace" data-val="true"  data-val-required="目的地不允许为空"  />
                                            <span class="field-validation-valid help-block" data-valmsg-for="EndPlace" data-valmsg-replace="true"></span>
                                           

                                        </td>

                                    </tr>
                                     <tr>
                                        <td class="align-right" style="width: 15%; background: #f6f6f6">途经地点
                                        </td>
                                        <td colspan="3">
                                            <input  id="RouteLine" name="RouteLine" placeholder="" type="text" class="form-control" value="@Model.RouteLine" data-val="true"  data-val-required="途经地点不允许为空"  />
                                            <span class="field-validation-valid help-block" data-valmsg-for="RouteLine" data-valmsg-replace="true"></span>

                                        </td>
                                        

                                    </tr>
                                    <tr>
                                        <td class="align-right" style="width: 15%; background: #f6f6f6">座位数
                                        </td>
                                        <td>

                                            <input type="text" id="Seats" name="Seats" placeholder="" class="col-xs-10 col-sm-5" data-val="true"  data-val-number="座位数量为非法的数字格式" data-val-regex="座位数量为非法的数字格式"
                                                   data-val-regex-pattern="^(-?\d+)(\.\d+)?$" data-val-required="座位数量为非法的数字格式"  value="@Model.Seats" />
                                                   
                                            <span class="field-validation-valid help-block" data-valmsg-for="Seats" data-valmsg-replace="true"></span>

                                        </td>
                                         <td class="align-right" style="width: 15%; background: #f6f6f6">票价
                                        </td>
                                        <td>

                                           <input type="text" id="Price" name="Price" placeholder="" class="col-xs-10 col-sm-5" data-val="true"  data-val-number="票价为非法的数字格式" data-val-regex="票价为非法的数字格式"
                                                   data-val-regex-pattern="^(-?\d+)(\.\d+)?$" data-val-required="票价为非法的数字格式"  value="@Model.Price" />
                                                   
                                            <span class="field-validation-valid help-block" data-valmsg-for="Price" data-valmsg-replace="true"></span>

                                        </td>
                                       

                                    </tr>
                              
                                 
                                    <tr>
                                        <td class="align-right" style="width: 15%; background: #f6f6f6">预订截止日期
                                        </td>
                                        <td>

                                           <input  id="EndDate" name="EndDate" placeholder="" type="text" class="form-control" value="@Model.EndDate.ToShortDateString()"  />

                                        </td>
                                        <td class="align-right" style="width: 15%; background: #f6f6f6">线路类别
                                        </td>
                                        <td >
                                            
                                            <select class="form-control" id="BusTypeId" name="BusTypeId">
                                              
                                                @foreach (var item in Model.BaseInfos)
                                                {

                                                    strSelect = "";
                                                    if (Model.BusTypeId == item.Id)
                                                    {
                                                        strSelect = "selected";
                                                    }
                                                        <option value="@item.Id" @strSelect>@item.MasterType</option>
                                                }
                                                   
                                                }
                                            </select>
                                            
                                        </td>
                                    </tr>
                                   
                                 
                                    <tr>
                                        <td class="align-right" style="width: 15%; background: #f6f6f6">备注说明
                                        </td>
                                        <td colspan="3">
                                            <textarea id="Remark" name="Remark" class="form-control" style="height: 400px">@Model.Remark</textarea>

                                        </td>
                                    </tr>
                                  

                                </tbody>
                            </table>
                        </div>


                        @if (ViewBag.scode == "1")
                        {
                            <div class="hr hr-2 dotted"></div>
                            <div class="alert alert-success">
                                <button type="button" class="close" data-dismiss="alert">
                                    <i class="icon-remove"></i>
                                </button>

                                <strong>
                                    <i class="icon-ok"></i>
                                    提示信息
                                </strong>

                                信息保存成功!
																
                            </div>
                        }
                        @if (ViewBag.scode == "0")
                        {
                            <div class="hr hr-2 dotted"></div>
                            <div class="alert alert-danger">
                                <button type="button" class="close" data-dismiss="alert">
                                    <i class="icon-remove"></i>
                                </button>

                                <strong>
                                    <i class="icon-remove"></i>
                                    错误提示
                                </strong>

                                @Html.ValidationSummary(true)

                            </div>

                        }
                        <div class="clearfix form-actions">
                            <div class="col-md-offset-3 col-md-9">
                                <button class="btn btn-info" type="submit">
                                    &nbsp;&nbsp;<i class="ace-icon fa fa-check bigger-110"></i>
                                    保存&nbsp;&nbsp;
                                </button>

                                &nbsp; &nbsp; &nbsp;
                                <button class="btn" type="button" onclick="funBack()">
                                    &nbsp;&nbsp;<i class="ace-icon fa fa-undo bigger-110"></i>
                                    返回&nbsp;&nbsp;
                                </button>
                            </div>
                        </div>




                    </div>



                </div>

            </div>
        }

    </div>


</div>
@section js{
    <script src="/assets/js/jquery.validate.min.js"></script>
    <script src="/assets/js/jquery.validate.unobtrusive.js"></script>
    <script src="/assets/js/jquery.validate.unobtrusive.bootstrap.js"></script>
    <script src="/assets/js/select2.js"></script>
    <script src="/assets/js/select2_locale_zh-CN.js"></script>
    <script charset="utf-8" src="/kindeditor/kindeditor-min.js" type="text/javascript"></script>
    <script charset="utf-8" src="/kindeditor/lang/zh_CN.js" type="text/javascript"></script>
    <script src="/Assets/webuploader/webuploader.js" type="text/javascript"></script>
     <script src="/assets/js/date-time/bootstrap-datepicker.min.js"></script>
    <script src="/assets/js/date-time/bootstrap-datepicker.zh-CN.js" ></script>
    <script type="text/javascript">
        KindEditor.ready(function (K) {
            var editor1 = K.create('#Remark', {
                cssPath: '/kindeditor/plugins/code/prettify.css',
                uploadJson: '/kindeditor/upload_json.ashx',
                fileManagerJson: '/kindeditor/file_manager_json.ashx'


            });
           

        });


        jQuery(function ($) {
            //$('#PubDate,#EndDate').datepicker({ autoclose: true, format: "yyyy-mm-dd", language: "zh-CN" });
            $('#StartDate,#EndDate').datepicker({
                autoclose: true,
                todayHighlight: true,
                language: "zh-CN"
            });
          
            

        });
        function funBack() {
            document.location = "/BusInfo/Index/0?m=@ViewBag.m&f=@ViewBag.f&p=@ViewBag.p&fid=@ViewBag.fid&sdate=@ViewBag.sdate&edate=@ViewBag.edate&keywords=@ViewBag.keywords";
        }
    </script>
}
